<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ page import="java.sql.*" %>	
<%@page import="net.sf.json.JSONObject"%>

<%String callback = request.getParameter("callback");%>
<%=callback %> (<%
	
	String id = request.getParameter("id");
	
	JSONObject jo = new JSONObject();
	Connection conn = null;
	PreparedStatement pstmt = null;
	
	try {

		Class.forName("com.mysql.jdbc.Driver");
		conn = DriverManager.getConnection("jdbc:mysql://localhost/itscreater", "itscreater", "campus123");
		
		String regidselect = "select * from gcm where ID = ?;";
		pstmt = conn.prepareStatement(regidselect);
		pstmt.setString(1, id);
		ResultSet rs = pstmt.executeQuery();
		rs.next();
		
		String push = rs.getString("Push");
		String vibrate = rs.getString("Vibrate");
		
		jo.put("push", push);
		jo.put("vibrate", vibrate);
		jo.put("success", "true");
		out.print(jo);
	
	} catch (Exception e) {

	}
	finally{
		try{
			pstmt.close();
		}
		catch (Exception ignored){
		}
		try{
			conn.close();
		}
		catch (Exception ignored){
		}
	}
%>);